#ifndef _LNBINTREE_H_
#define _LNBINTREE_H_

#include <stdio.h>
#include <stdlib.h>
#include "declare.h"
#include "lnqueue.h"

PLNBinTree createEmptyBinTree();
PLNBinTree constructBinTree(PBinTreeNode root, PLNBinTree left, PLNBinTree right);
PLNBinTree duplicateBinTree(PLNBinTree t);

int addChildBinTree(PLNBinTree *t, PBinTreeNode c, ELEMTYPE x, int flag);
int deleteChildBinTree(PLNBinTree t, PBinTreeNode c, int flag);
PBinTreeNode locateChildBinTree(PLNBinTree t, ELEMTYPE x);

int isNULL(PLNBinTree t);

PBinTreeNode root(PLNBinTree t);
PBinTreeNode parent(PLNBinTree t, PBinTreeNode c);
PBinTreeNode leftChild(PLNBinTree t, PBinTreeNode p);
PBinTreeNode rightChild(PLNBinTree t, PBinTreeNode p);

void preOrder(PLNBinTree t);
void inOrder(PLNBinTree t);
void postOrder(PLNBinTree t);
void levelOrder(PLNBinTree t, int flag);

int leaf(PLNBinTree t);

int visit(PLNBinTree t, PBinTreeNode p);

int print(PLNBinTree t);
int destroyBinTree(PLNBinTree t);
#endif
